perf: enable Android emulator Quick Boot - #359
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Owned Android AVDs cold-boot on every restart because Stim disables Quick Boot loading and saving. The measurements in #284 found about 22 seconds of avoidable startup time.
The flags were added in PR #93 to reduce AVD storage (original commit), before Stim measured and configured owned-AVD userdata.
Fixes #284.
Solution
Use Android Emulator's default Quick Boot policy for owned AVDs. Displayless Linux retains disabled snapshots because its software renderer makes them unreliable. New or invalid snapshots fall back to a cold boot; Android invalidates snapshots after emulator, system-image, or AVD-setting changes (Android documentation).
Teardown preserves the bounded guest-write flush from #357 and waits for the emulator process to exit after saving its snapshot. The 60-second shutdown budget includes sync and the adb command. Invalid PID locks, unresolved live emulators, shutdown timeouts, and pre-deletion restarts prevent deletion and keep the ownership record. Windows can expose an empty PID file before writing its PID, so a present invalid lock refuses cleanup (upstream lock implementation).
The storage policy keeps one automatic snapshot. New owned AVDs retain the configurable 8 GiB default data partition; existing AVDs keep their size.
worktree removedeletes the whole AVD, andgcreports stale or orphaned owned-AVD sizes. The guide and benchmark control prompt describe the same policy.Test plan
default_boot. The next boot took 5.6 seconds, logged a successful snapshot load, and restored a marker written immediately before shutdown. These are one local run's observations, not a benchmark series.